package ithink.link.stack;

import ithink.link.base.message.LinkMessage;

/**
 * Created by zaqb on 17-9-11.
 */
public interface IConnection {
    State getState();
    String remoteIp();
    int remotePort();

    Object getContext();

    void setContext(Object context);
    void sendMessage(LinkMessage message);
    void disconnect();

    void disconnect(Exception ex);
    void setListener(IConnectionListener listener);

    enum State
    {
        IDLE,
        CONNECTING,
        CONNECTED,
        DISCONNECTED,
    }
    enum ConnectionType {
        STATEFUL,
        STATELESS,
    }
}